home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 4.8 KB | 141 lines | [TEXT/MPS ] |
- // USynchScroller.h
- // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
-
- #ifndef __USYNCHSCROLLER__
- #define __USYNCHSCROLLER__
-
- // MacApp
-
- #ifndef __UGEOMETRY__
- #include "UGeometry.h"
- #endif
-
- #ifndef __USCROLLER__
- #include "UScroller.h"
- #endif
-
-
- //----------------------------------------------------------------------------------------
- // Forward and external class declarations.
- //----------------------------------------------------------------------------------------
-
- class TSecondaryScroller;
- class TList;
-
-
- //----------------------------------------------------------------------------------------
- // Constants
- //----------------------------------------------------------------------------------------
-
- const short kVDependent = 1; // Dependent scroller is dependent on
- // vertical translation
-
- const short kNotVDependent = 0; // Dependent scroller is NOT dependent on
- // vertical translation
-
- const short kHDependent = 1; // Dependent scroller is dependent on
- // horizontal translation
-
- const short kNotHDependent = 0; // Dependent scroller is NOT dependent on
- // horizontal translation
-
- //----------------------------------------------------------------------------------------
- // TPrimaryScroller: A TPrimaryScroller has a list of secondary scrollers (if non-NULL):
- // When it scrolls it makes the scrollers on the list scroll too in the very same
- // ScrollRect toolbox call if possible. If some of the secondary scrollers can't be
- // scrolled in the same ScrollRect call because they only scroll in one direction then
- // they will be scrolled separately as necessary.
- //----------------------------------------------------------------------------------------
-
- class TPrimaryScroller : public TScroller
- {
- MA_DECLARE_CLASS;
-
- public:
- TList* fSecondaryScrollers; // The list of secondary scrollers, if any
-
- TPrimaryScroller();
- // Constructor
-
- void IPrimaryScroller(TView* itsSuperView,
- const VPoint& itsLocation,
- const VPoint& itsSize,
- SizeDeterminer itsHSizeDet,
- SizeDeterminer itsVSizeDet,
- const VPoint& itsMax,
- Boolean wantHorzSBar,
- Boolean wantVertSBar);
- // Initialization method for TPrimaryScroller.
-
- virtual ~TPrimaryScroller();
- // Frees its list
-
- virtual void AddSecondaryScroller(TSecondaryScroller* itsSecondaryScroller,
- VCoordinate itsHDependency,
- VCoordinate itsVDependency);
- // Become associated with the secondary scroller(s). The V and H dependencies
- // could someday be scale factors but for now are kVDependent and kHDependent for
- // now.
-
- virtual void RemoveSecondaryScroller(TSecondaryScroller* itsSecondaryScroller);
- // Remove the secondary scroller.
-
- virtual void DoScroll(const VPoint& delta, Boolean redraw);
- // Assure that fTranslation is always updated in the secondary scrollers
-
- virtual void ScrollDraw(const VPoint& delta, Boolean invalidate);
- // Scroll the secondary scrollers as well (unless called via SetScrollLimits)
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // TSecondaryScroller: A TSecondaryScroller is controlled by a TPrimaryScroller (see
- // above). When it is told to scroll, it delegates the job to the TPrimaryScroller.
- // Constraints (none are checked by this unit at this time): 1. It and its subview must
- // have the same length in the desired synch-scroll directions. 2. Commands for dragging
- // within it must have it as their fScroller. 3. No scroll bars!
- //----------------------------------------------------------------------------------------
-
- class TSecondaryScroller : public TScroller
- {
- MA_DECLARE_CLASS;
-
- public:
- TPrimaryScroller* fPrimaryScroller; // the primary scroller
-
- CPoint fDeltaFactor; // kVDependent and kHDependent (or not)
-
- TSecondaryScroller();
- // Constructor
-
- void ISecondaryScroller(TView* itsSuperView,
- const VPoint& itsLocation,
- const VPoint& itsSize,
- SizeDeterminer itsHSizeDet,
- SizeDeterminer itsVSizeDet,
- const VPoint& itsMax,
- Boolean wantHorzSBar,
- Boolean wantVertSBar);
- // Initialization method for TSecondaryScroller.
-
- virtual ~TSecondaryScroller();
-
- virtual void DoScroll(const VPoint& delta, Boolean redraw);
- // Polarize and delegate scroll attempts to the primary scroller (unless called
- // via SetScrollLimits)
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // Global function declarations
- //----------------------------------------------------------------------------------------
-
- extern void InitUSynchScroller();
-
-
- #endif
-
-
-